import { EntitySchema } from '@mikro-orm/core';

export class LeLiveGoods {
  id!: string;
  name!: string;
  cover!: string;
  priceType: boolean = false;
  price!: string;
  price2!: string;
  link!: string;
  auditId!: string;
  goodsId: number = 0;
  AppID!: string;
  merchantId!: string;
  createdTime?: number = 0;
  updatedTime?: number = 0;
  deletedTime?: number = 0;
  isDeleted?: number = 0;
  gid: number = 0;
}

export const LeLiveGoodsSchema = new EntitySchema({
  class: LeLiveGoods,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    name: { type: 'string', length: 1024 },
    cover: { type: 'string', length: 4096 },
    priceType: { type: 'boolean', default: false },
    price: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    price2: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    link: { type: 'string', length: 256 },
    auditId: { type: 'string', length: 255 },
    goodsId: { type: 'number', default: 0 },
    AppID: { type: 'string', fieldName: 'AppID', length: 50 },
    merchantId: { type: 'string', columnType: 'bigint', defaultRaw: `1` },
    createdTime: { type: 'number', nullable: true, default: 0 },
    updatedTime: { type: 'number', nullable: true, default: 0 },
    deletedTime: { type: 'number', nullable: true, default: 0 },
    isDeleted: { type: 'number', columnType: 'tinyint', nullable: true, default: 0 },
    gid: { type: 'number', default: 0 },
  },
});
